
import { Local } from '/@/utils/storage';

/**
 * 样式风格缓存
 * @method set 设置缓存
 * @method get 获取缓存
 * @method remove 移除缓存
 * @method clear 移除全部缓存
 */
export const LocalStorge = {
	// 设置缓存
	set<T>(key: string, val: T) {
        const json = Local.get('themeLayout') ?? {};
        json[key] = val;
		Local.set('themeLayout',json);
	},
	// 获取缓存
	get(key: string) {
        const json = Local.get('themeLayout') ?? {};
		return json.hasOwnProperty(key)?json[key]:'';
	},
	// 移除缓存
	remove(key: string) {
        const json = Local.get('themeLayout') ?? {};
        json[key] = '';
		Local.set('themeLayout',json);
	},
	// 移除全部缓存
	clear() {
		Local.set('themeLayout',{});
	},
};